<?php
class FP_Users extends FP_Gateway
{

    protected $_dao_class = 'FP_Dao_User';

    protected $_model_class = 'FP_User';

    protected $_primary_key = 'user_id';

    public function getRoleId($pRole){
	$Roles = FP_Application::classFactory('Roles');
	return $Roles->getModelObjectId($pRole);
    }

    public function getRole($pUser){
	$Roles = FP_Application::classFactory('Roles');
	return $Roles->fetch($pUser->role_id);
    }

    public function getPermissions($pUser){
	$user_id = $this->getModelObjectId($pUser);

	$Permissions = FP_Application::classFactory('Permissions');
	return $Permissions->fetchPermissionsForUser($user_id);
    }

    public function addPermissionToUser($pUser, $pPermission){
	$user_id = $this->getModelObjectId($pUser);

	$Permissions = FP_Application::classFactory('Permissions');
	$Permissions->addPermissionToUser($user_id, $pPermission);

    }
}

 ?>